package com.lagou.service.impl;

import com.lagou.dao.EmployeeMapper;
import com.lagou.domain.Employee;
import com.lagou.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Service  //声明为service bean
@Transactional //支持事务操作
public class EmployeeServiceImpl implements EmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public int saveEmployee(Employee employee) {
        return employeeMapper.saveEmployee(employee);
    }

    @Override
    public int deleteBatch(Integer[] empIds) {
        return employeeMapper.deleteBatch(empIds);
    }

    @Override
    public int deleteEmp(Integer id) {

        return employeeMapper.deleteEmp(id);
    }

    @Override
    public Employee queryEmpByEmpId(Integer empId) {
        return employeeMapper.queryEmpByEmpId(empId);
    }

    @Override
    public List<Employee> queryAllEmp() {


        List<Employee> employeeList = employeeMapper.queryAllEmp();

        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

        for (Employee employee : employeeList) {


        }


        return employeeList;


    }

    @Override
    public int updateEmployee(Employee employee) {

        System.out.println("updateEmployee1--->"+employee);
        return employeeMapper.updateEmployee(employee);
    }


}
